<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf"%>
	<link rel="stylesheet" href="${ctx}/js/date/bootstrap_select.min.css">
	<script src="${ctx}/js/date/bootstrap_select.min.js"></script>
<script type="text/javascript" src="${ctx}/js/system/user/add.js">
	
</script>
<style type="text/css">
	.col-sm-3 {
		position: relative;
		width: 15%;
		float: left;
		text-align: right;
	}

	.col-sm-9 {
		width: 32%;
		float: left;
		text-align: left;
	}


	label[class^="btn btn-default"] {
		margin-top: -4px;
	}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/workOrder/addWorkOrder.shtml">
		<input type="hidden" name="worKOrderFormMap.stockid" id="stockid">
		<section class="panel panel-default">

		<div class="panel-body">
			<div class="form-group">
				<div class="col-sm-3">
					<label class="control-label">计划单号</label>
				</div>
				<div class="col-sm-9">
					<input type="text" class="form-control" name="worKOrderFormMap.bpcode" id="bpcode" readonly="readonly">
				</div>

				<div class="form-group">
					<label class="col-sm-3 control-label">编制人</label>
					<div class="col-sm-9">
						<select class="form-control selectpicker show-tick" data-live-search="true" name="worKOrderFormMap.bpedemid" id="bpedemid" >
							<option value="0">-请选择-</option>
							<c:forEach items="${emp}" var="emps">
								<option value="${emps.empId}">${emps.empName}</option>
							</c:forEach>
						</select>

					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">成品名称</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" name="worKOrderFormMap.stockname" id="stockname">
					<span class="input-group-btn">
							<button class="btn btn-info" id="workorder" type="button"
									style="height: 34px; position: absolute; top: -34px; left: 230px;"
									onclick="getBomInfo();">
								<span class="glyphicon glyphicon-search"></span>
							</button>
					</span>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">计划数量</label>
					<div class="col-sm-9">
						<input type="text" class="form-control" name="worKOrderFormMap.num" id="num">
					</div>
				</div>

			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">生产车间</label>
				<div class="col-sm-9">
					<select class="form-control" name="worKOrderFormMap.depid" id="depid">
						<c:forEach items="${dep}" var="d">
							<option value="${d.deid}">${d.dename}</option>
						</c:forEach>

					</select>
				</div>

				<div class="form-group">
					<label class="col-sm-3 control-label">计划状态</label>
					<div class="col-sm-9">
						<select class="form-control" name="worKOrderFormMap.bpbillstateid" id="bpbillstateid">
							<option value="5">计划</option>
						</select>
					</div>
				</div>
			</div>

            <div class="form-group">
                <label class="col-sm-3 control-label">订购日期</label>
                <div class="col-sm-9">
					<input type="date" class="form-control"
						   name="worKOrderFormMap.bpbtime"
						   id="bpbtime">
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">要求日期</label>
                    <div class="col-sm-9">
                        <input type="date" class="form-control"
                               name="worKOrderFormMap.bpetime"
                               id="bpetime">
                    </div>
                </div>
            </div>

            <%--<div class="form-group">--%>
                <%--<label class="col-sm-3 control-label">生产状态</label>--%>
                <%--<div class="col-sm-9">--%>
					<%--<select class="form-control" name="worKOrderFormMap.bpbillstateid" id="bpbillstateid">--%>
						<%--<option value="1">完成</option>--%>
						<%--<option value="2">未完成</option>--%>
					<%--</select>--%>
                <%--</div>--%>
            <%--</div>--%>
		<footer class="panel-footer text-right bg-light lter">
		<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer>
		</section>
	</form>
	<script type="text/javascript" src="${ctx}/js/public/public.js"></script>
	<script type="text/javascript">
        //自动生成id
        //
        $(document).ready(function(){
            $('select').selectpicker();

            var myDate = getNowFormatDate();
            $("#bpcode").val("BP"+ myDate + getRandomInt(100,1000));
        });
		onloadurl();

        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            //OF2022-02-12 13:52:30
            var currentdate = year + seperator1 + month + seperator1 + strDate
                + date.getHours() + seperator2 + date.getMinutes()
                + seperator2 + date.getSeconds();
            currentdate= currentdate.replaceAll("-","");
            currentdate= currentdate.replaceAll(":","");
            return currentdate;
        }

        function getRandomInt(min, max) {
            min = Math.ceil(min);
            max = Math.floor(max);
            return Math.floor(Math.random() * (max - min)) + min; //不含最大值，含最小值
        }
        function inser_data(data1, data2) {
            $("#stockid").val(data1);
            $("#stockname").val(data2);
        }
	</script>
	<script type="text/javascript"
		src="${ctx}/notebook/notebook_files/bootstrap-filestyle.min.js"></script>
</body>
</html>